package nanyang.com.dig88.Fragment;

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ListView;

import java.util.Arrays;

import butterknife.Bind;
import nanyang.com.dig88.Entity.DiscountBean;
import nanyang.com.dig88.R;
import nanyang.com.dig88.Table.utils.DiscountDefaultHelper;
import xs.com.mylibrary.allinone.util.AppTool;
import xs.com.mylibrary.pulltorefresh.library.PullToRefreshBase;
import xs.com.mylibrary.pulltorefresh.library.PullToRefreshListView;

/**
 * 优惠
 */
public class PromotionsFragment extends BaseFragment {
    @Bind(R.id.wv_promotions)
    WebView webView;
    @Override
    protected int getFragmentLayoutRes() {
        return R.layout.fragment_promotions;
    }


    @Override
    protected void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        AppTool.setAppLanguage(mContext, "");
        String url = "http://update.apps.khmergaming.net/prom/jfh08/index.htm";
        //     Log.i(WebSiteUrl.Tag,"report url="+url);
        webView.getSettings().setJavaScriptEnabled(true);//设置使用够执行JS脚本
        webView.getSettings().setBuiltInZoomControls(false);//设置使支持缩放
        //    webView.getSettings().setDefaultFontSize(10);
        //   webView.getSettings().setSupportZoom(true);
        //  webView.setInitialScale(125);
        // webView.getSettings().setTextSize(WebSettings.TextSize.SMALLER);
        //支持javascript
        webView.getSettings().setJavaScriptEnabled(true);
// 设置可以支持缩放
        webView.getSettings().setSupportZoom(true);
// 设置出现缩放工具
        webView.getSettings().setBuiltInZoomControls(true);
//扩大比例的缩放
        webView.getSettings().setUseWideViewPort(true);
//自适应屏幕
        webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
        webView.getSettings().setLoadWithOverviewMode(true);


//        webView.loadUrl(url);
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                // TODO Auto-generated method stub
                view.loadUrl(url);// 使用当前WebView处理跳转
                return true;//true表示此事件在此处被处理，不需要再广播
            }

            @Override   //转向错误时的处理
            public void onReceivedError(WebView view, int errorCode,
                                        String description, String failingUrl) {
                // TODO Auto-generated method stub

            }
        });

    }
}
